package com.hub.realtime.resource.model;

import com.hub.realtime.resource.domain.ResFlinkProject;
import java.util.*;
import org.eclipse.jgit.lib.BatchingProgressMonitor;

public class GitProcessMoitor extends BatchingProgressMonitor {
    private final List<String> logList;
    private final ResFlinkProject project;


    public GitProcessMoitor(ResFlinkProject project, List<String>logList)
    {
        this.project=project;
        this.logList=logList;
    }

    @Override
    protected void onUpdate(String taskName, int workCurr) {

    }

    @Override
    protected void onEndTask(String taskName, int workCurr) {

    }

    @Override
    protected void onUpdate(String taskName, int workCurr, int workTotal, int percentDone) {
        String log=String.format("项目：%s 正在克隆代码，当前任务task：%s ,当前正在克隆第%d个文件 ,总共%d个文件 ,克隆了 %s",project.getName(),
                taskName,workCurr,workTotal,(percentDone+"%"));
        logList.add(log);
    }

    @Override
    protected void onEndTask(String taskName, int workCurr, int workTotal, int percentDone) {

    }
}
